<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<script type="text/javascript">
	$(function() {
		parent.$.messager.progress('close');

		$('#residenceId').combobox({
			onSelect : function(a){
				$('#parent-id').combobox('reload','/buildingManager/combobox?residenceId=' + a.value);
			},
			onLoadSuccess : function(e){
				$('#residenceId').combobox('clear');
			}
		});
		
		$('#form').form({
			url : '/buildingUnitManager/edit',
			onSubmit : function() {
				parent.$.messager.progress({
					title : '提示',
					text : '数据处理中，请稍后....'
				});
				var isValid = $(this).form('validate');
				if (!isValid) {
					parent.$.messager.progress('close');
				}
				return isValid;
			},
			success : function(result) {
				parent.$.messager.progress('close');
				try{
					result = $.parseJSON(result);
					if (result.success) {
						parent.$.modalDialog.openner_datagrid.datagrid('reload');
						parent.$.modalDialog.handler.dialog('close');
					}  else {
						parent.$.messager.alert("提示",result.msg,"info");
					}
				} catch(e){
					parent.$.messager.alert("提示",result,"info");
				}
			}
		});
	});
</script>
<div class="easyui-layout" data-options="fit:true,border:false">
	<div data-options="region:'center',border:false" title="" style="overflow: hidden;">
		<form id="form" method="post">
			<input name="id" value="${buildingUnit.id }" type="hidden"/>
			<table class="table table-hover table-condensed">
				<tr>
					<th>当前小区</th>
					<td>
					<input name="residenceId" type="hidden" class="span2" value="${buildingUnit.residenceId }" style="width:380px"  readonly="readonly"/>
					<input name="residenceName"  readonly="readonly"  style="width:380px" value="${buildingUnit.residenceName }" />
					</td>
				</tr>
				<tr>
					<th>楼栋</th>
					<td>
						<input name="parentId" type="hidden" value="${buildingUnit.parentId }" style="width:380px">
						<input readonly="readonly" style="width:380px"  value="${buildingUnit.parentName }"/>
					</td>
				</tr>
				<tr>
					<th>单元名称</th>
					<td>
					<input name="name" type="text" placeholder="单元名称" style="width:380px" class="easyui-validatebox span2" data-options="required:true" value="${buildingUnit.name }">
					</td>
				</tr>
				<tr>
					<th>排序</th>
					<td>
					<input class="easyui-slider"  name="sortWeight" style="width:380px" data-options="showTip:true" value="${buildingUnit. sortWeight}">
					</td>
				</tr>
			</table>
		</form>
	</div>
</div>